<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>libnetconf: Client</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../libnetconf-logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">libnetconf
   &#160;<span id="projectnumber">0.9.0-33_trunk</span>
   </div>
   <div id="projectbrief">NETCONF Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li><a href="../../annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d1/d25/client.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Modules</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Client </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="client-workflow"></a>
Client Workflow</h1>
<p>Here is a description of using libnetconf functions in a NETCONF client:</p><ol type="1">
<li><b>Set verbosity (optional)</b>.<br />
The verbosity of the libnetconf can be set by <a class="el" href="../../d3/d35/group__gen_a_p_i.html#gadd8fd7b3bb2e7cba580c9a4229fe02d7" title="Set libnetconf&#39;s verbosity level. ">nc_verbosity()</a>. By default, libnetconf is completely silent.<br />
There is a default message-printing function that writes messages on stderr. The application's specific message printing function can be set via <a class="el" href="../../d3/d35/group__gen_a_p_i.html#ga806dfa9c27d2b8076bae21bcd549cce7" title="Set a callback function for printing libnetconf&#39;s messages.If the func parameter is NULL...">nc_callback_print()</a> function.</li>
<li><b>Set SSH authentication methods priorities (optional)</b>.<br />
libnetconf supports several SSH authentication methods for connecting to a NETCONF server over SSH. However, the used method is selected from a list of supported authentication methods provided by the server. Client is allowed to specify the priority of each supported authentication method via <a class="el" href="../../db/d52/group__session.html#ga13119fdaa84544bf254bdb35ffdf83e0" title="Set the preference of the SSH authentication methods. ">nc_ssh_pref()</a> function. The authentication method can also be disabled using a negative priority value.<br />
Default priorities are following:<ul>
<li><em>Interactive</em> (value 3)</li>
<li><em>Password</em> (value 2)</li>
<li><em>Public keys</em> (value 1)</li>
</ul>
</li>
<li><b>Set your own callback(s) for the SSH authentication methods (optional)</b>.<br />
User credentials are received via the callback functions specific for each authentication method. There are default callbacks, but application can set their own via:<ul>
<li><em>Interactive</em> - <a class="el" href="../../db/d52/group__session.html#gacb6042fe2f3cfe5d79e01de599c546eb" title="Set a callback function for passing user credentials into the libssh2&#39;s keyboard-interactive authenti...">nc_callback_sshauth_interactive()</a></li>
<li><em>Password</em> - <a class="el" href="../../db/d52/group__session.html#ga28299d575ef4e234ed96bad5c4f086fb" title="Set a callback function for passing the user password into the libssh2&#39;s password authentication meth...">nc_callback_sshauth_password()</a></li>
<li><em>Publuc keys</em> - <a class="el" href="../../db/d52/group__session.html#ga81ef9b1c1949bbffd86cbfd9aa159726" title="Set a callback function for passing the user password into the libssh2&#39;s publickey authentication met...">nc_callback_sshauth_passphrase()</a>. Here can the paths to the key files be also specified by nc_set_publickey_path() and nc_set_privatekey_path(). If not set, libnetconf tries to find them in the default paths.</li>
</ul>
</li>
<li><b>Connect to the NETCONF server(s)</b>.<br />
Simply call <a class="el" href="../../db/d52/group__session.html#gae3858d998d19cb2fb700b15fdf602f23" title="Create NETCONF session to the specified server. ">nc_session_connect()</a> to connect to the specified host via SSH. Authentication method is selected according to the default values or the previous steps.</li>
<li><b>Prepare NETCONF rpc message(s)</b>.<br />
Creating NETCONF rpc messages is covered by the functions described in the section <a class="el" href="../../db/de9/group__rpc.html">NETCONF rpc</a>. The application prepares NETCONF rpc messages according to the specified attributes. These messages can be then repeatedly used for communication over any of the created NETCONF sessions.</li>
<li><b>Send the message to the selected NETCONF server</b>.<br />
To send created NETCONF rpc message to the NETCONF server, use <a class="el" href="../../db/de9/group__rpc.html#gaeb0d93ea1b5ef0c22c9e5372425fb5c3" title="Send <rpc> request via specified NETCONF session. This function is supposed to be performed only by N...">nc_session_send_rpc()</a> function. <a class="el" href="../../db/de9/group__rpc.html#ga27d3fe78769630932a18c726df4fe6e6" title="Send <rpc> and receive <rpc-reply> via the specified NETCONF session. ">nc_session_send_recv()</a> function connects sending and receiving the reply (see the next step) into one blocking call.</li>
<li><b>Get the server's rpc-reply message</b>. When the NETCONF rpc is sent, use <a class="el" href="../../d0/de2/group__reply.html#ga1b8c8ca9516003938e8f647bd870beaa" title="Receive <rpc-reply> response from the specified NETCONF session. This function is supposed to be perf...">nc_session_recv_reply()</a> to receive the reply. To learn when the reply is coming, a file descriptor of the communication channel can be checked by poll(), select(), ... This descriptor can be obtained via <a class="el" href="../../db/d52/group__session.html#ga826890ed745633bc2d31a53971dada32" title="Get the input file descriptor to asynchronous control of input events. ">nc_session_get_eventfd()</a> function.</li>
<li><b>Close the NETCONF session</b>.<br />
When the communication is done, the NETCONF session should be freed (session is also properly closed) via <a class="el" href="../../db/d52/group__session.html#gaa5994f45a7031dc931bdf4a3acebedee" title="Cleanup the session structure and free all the allocated resources. ">nc_session_free()</a> function.</li>
<li><b>Free all created objects</b>.<br />
Do not forget to free created rpc messages (<a class="el" href="../../db/de9/group__rpc.html#ga4041bda37caa9eedb7a1e2534280f3df" title="Free rpc message. ">nc_rpc_free()</a>), <a class="el" href="../../db/de9/group__rpc.html#ga599c715b0aee0f1f2ed231ce1d78e5bd">filters</a> (<a class="el" href="../../db/de9/group__rpc.html#ga0dbfd598d6fd303819817370cdf63229" title="Destroy the filter structure. ">nc_filter_free()</a>) or received NETCONF rpc-replies (<a class="el" href="../../d0/de2/group__reply.html#ga17aa9f38d7b75dec1a57b478b0b39710" title="Free reply message. ">nc_reply_free()</a>). </li>
</ol>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../da/d1b/usage.html">Using libnetconf</a></li>
    <li class="footer">Generated on Wed Jan 28 2015 12:51:10 for libnetconf by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.8 </li>
  </ul>
</div>
</body>
</html>
